﻿

using OpenCvSharp;

using System;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 绘制圆圈
    /// </summary>
    [Filter("绘制椭圆",FilterType.Draw)]
    public class DrawEllipse : FilterBase
    {
        /// <summary>
        /// 中心点
        /// </summary>
        [InputParameter("中心点")] 
        public CVPoint Center { get; set; }=new CVPoint() { X=10,Y=10};
        /// <summary>
        /// 大小
        /// </summary>
        [InputParameter("大小")]
        public CVSize Axes { get; set; } = new CVSize { Height = 50, Width = 50 };
        /// <summary>
        /// 角度
        /// </summary>
        [InputParameter("角度")]
        public int Angle { get; set; } = 0;
        /// <summary>
        /// 开始角度
        /// </summary>
        [InputParameter("开始角度")]
        public int StartAngle { get; set; } = 0;
        /// <summary>
        /// 结束角度
        /// </summary>
        [InputParameter("结束角度")]
        public int EndAngle { get; set; } = 360;
        /// <summary>
        /// 颜色
        /// </summary>
        [InputParameter("颜色")]
        public Scalar Color { get; set; } = Scalar.Red;
        /// <summary>
        /// 粗细
        /// </summary>
        [InputParameter("粗细")]
        public int Thickness { get; set; } = 1;
        /// <summary>
        /// 线条类型
        /// </summary>
        [InputParameter("线条类型")]
        public LineTypes LineTypes { get; set; } = LineTypes.Link8;

        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Cv2.Ellipse(mat,Center, Axes,Angle, StartAngle, EndAngle,Color, Thickness, LineTypes);
            return ResultData<Mat>.Accept(TextResource.drawing_line_success, mat);

        }
    }
}
